<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // 创建BigInt
    const bigNum = 9007199254740993n; // 后缀n
    // 或
    const bigFromStr = BigInt("9007199254740993");
    const bigFromNum = BigInt(Number.MAX_SAFE_INTEGER) + 2n;

    // 运算
    const a = 123456789012345678901234567890n;
    const b = 987654321098765432109876543210n;

    console.log(a + b); // 1111111110111111111011111111100n
    console.log(a * b); // 121932631137021795226185032733622923332237463801111263526900n
    console.log(b / a); // 8n (整除)

    // 注意事项
    console.log(typeof bigNum); // "bigint"
    console.log(bigNum === 9007199254740993); // false (类型不同)
    console.log(bigNum == 9007199254740993); // true (值相等)
</script>
</html>